pkt_filter_cc = 'pkt_filter_bpf.cc'
if SYSTEM == 'linux'
    iface_mgr = 'iface_mgr_linux.cc'
    pkt_filter_cc = 'pkt_filter_lpf.cc'
elif SYSTEM == 'freebsd' or SYSTEM == 'netbsd' or SYSTEM == 'openbsd' or SYSTEM == 'darwin'
    iface_mgr = 'iface_mgr_bsd.cc'
elif SYSTEM == 'sun'
    iface_mgr = 'iface_mgr_sun.cc'
else
    error(f'Build failed: Unsupported system "@SYSTEM@".')
endif

kea_dhcp_lib = shared_library(
    'kea-dhcp',
    'classify.cc',
    'duid.cc',
    'duid_factory.cc',
    'hwaddr.cc',
    'iface_mgr.cc',
    iface_mgr,
    'libdhcp++.cc',
    'opaque_data_tuple.cc',
    'option.cc',
    'option4_addrlst.cc',
    'option4_client_fqdn.cc',
    'option4_dnr.cc',
    'option6_addrlst.cc',
    'option6_auth.cc',
    'option6_client_fqdn.cc',
    'option6_dnr.cc',
    'option6_ia.cc',
    'option6_iaaddr.cc',
    'option6_iaprefix.cc',
    'option6_pdexclude.cc',
    'option6_status_code.cc',
    'option_classless_static_route.cc',
    'option_custom.cc',
    'option_data_types.cc',
    'option_definition.cc',
    'option_opaque_data_tuples.cc',
    'option_space.cc',
    'option_string.cc',
    'option_vendor.cc',
    'option_vendor_class.cc',
    'packet_queue_mgr4.cc',
    'packet_queue_mgr6.cc',
    'pkt.cc',
    'pkt4.cc',
    'pkt4o6.cc',
    'pkt6.cc',
    'pkt_filter.cc',
    'pkt_filter6.cc',
    'pkt_filter_inet.cc',
    'pkt_filter_inet6.cc',
    pkt_filter_cc,
    'protocol_util.cc',
    include_directories: [include_directories('.')] + INCLUDES,
    install: true,
    install_dir: LIBDIR,
    install_rpath: INSTALL_RPATH,
    build_rpath: BUILD_RPATH,
    link_with: LIBS_BUILT_SO_FAR,
    version: '123.0.0',
)
LIBS_BUILT_SO_FAR = [kea_dhcp_lib] + LIBS_BUILT_SO_FAR
subdir('testutils')
subdir('tests')
kea_dhcp_headers = [
    'classify.h',
    'dhcp4.h',
    'dhcp6.h',
    'docsis3_option_defs.h',
    'duid.h',
    'duid_factory.h',
    'hwaddr.h',
    'iface_mgr.h',
    'iface_mgr_error_handler.h',
    'libdhcp++.h',
    'opaque_data_tuple.h',
    'option.h',
    'option4_addrlst.h',
    'option4_client_fqdn.h',
    'option4_dnr.h',
    'option6_addrlst.h',
    'option6_auth.h',
    'option6_client_fqdn.h',
    'option6_dnr.h',
    'option6_ia.h',
    'option6_iaaddr.h',
    'option6_iaprefix.h',
    'option6_pdexclude.h',
    'option6_status_code.h',
    'option_classless_static_route.h',
    'option_custom.h',
    'option_data_types.h',
    'option_definition.h',
    'option_int.h',
    'option_int_array.h',
    'option_opaque_data_tuples.h',
    'option_space.h',
    'option_space_container.h',
    'option_string.h',
    'option_vendor.h',
    'option_vendor_class.h',
    'packet_queue.h',
    'packet_queue_mgr.h',
    'packet_queue_mgr4.h',
    'packet_queue_mgr6.h',
    'packet_queue_ring.h',
    'pkt.h',
    'pkt4.h',
    'pkt4o6.h',
    'pkt6.h',
    'pkt_filter.h',
    'pkt_filter6.h',
    'pkt_filter_bpf.h',
    'pkt_filter_inet.h',
    'pkt_filter_inet6.h',
    'pkt_filter_lpf.h',
    'pkt_template.h',
    'protocol_util.h',
    'socket_info.h',
    'std_option_defs.h',
]
install_headers(kea_dhcp_headers, preserve_path: true, subdir: 'kea/dhcp')
